﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VOL;
using BLL;
using System.Data;

namespace Web
{
    public partial class Products : System.Web.UI.Page
    {
        DMHangBL _DMHangBL = new DMHangBL();
        protected void Page_Load(object sender, EventArgs e)
        {
            DMHang obj = new DMHang();
            int _MaLoaiHang = 0;
            int _MaNhaCungCap = 0;
            if (Request.QueryString["MaLoaiHang"] != null)
            {
                int.TryParse(Request.QueryString["MaLoaiHang"].ToString(), out _MaLoaiHang);
            }
            if (Request.QueryString["MaNhaCungCap"] != null)
            {
                int.TryParse(Request.QueryString["MaNhaCungCap"].ToString(), out _MaNhaCungCap);
            }

            if (_MaLoaiHang > 0)
            {
                obj.MaLoaiHang = _MaLoaiHang;
            }
            if (_MaNhaCungCap > 0)
            {
                obj.MaNhaCungCap = _MaNhaCungCap;
            }

            DataTable dt = _DMHangBL.GetData(obj);
            CollectionPager1.PageSize = 4;
            CollectionPager1.DataSource = dt.DefaultView;
            CollectionPager1.BindToControl = RepeaterProducts;
            RepeaterProducts.DataSource = CollectionPager1.DataSourcePaged;
        }
    }
}